package org.nf.shopping.service.Impl;

import com.github.pagehelper.PageInfo;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.nf.shopping.common.exception.ErrorsEnum;
import org.nf.shopping.common.exception.LoginException;
import org.nf.shopping.entity.Employee;
import org.nf.shopping.mapper.EmployeeMapper;
import org.nf.shopping.service.EmployeeService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author czl
 * @Date 2024-12-02
 */
@Service
@RequiredArgsConstructor
public class EmployeeServiceImpl implements EmployeeService {

    private final EmployeeMapper employeeMapper;
    @Override
    public PageInfo<Employee> employeePage(Integer pageSize, Integer pageNum, String name) {
        List<Employee> list = employeeMapper.listEmployee(pageSize,pageNum,name);
        PageInfo<Employee> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public void updateEmployee(Employee employee) {
        employeeMapper.updateEmployee(employee);
    }

    @Override
    public void deloneEmployee(Integer id) {
        employeeMapper.deloneEmployee(id);
    }

    @Override
    public void addEmployee(Employee employee) {
        employeeMapper.addEmployee(employee);
    }

    @Override
    public List<Employee> getEmployeeList() {
        return employeeMapper.getEmployeeList();
    }

}
